partial class MULTIMAP_INCL{K,E}
****
Partial class for full fledged multi-maps


Ancestors
RO_MULTIMAP_INCL{_,_} COMPARE{_}

Descendants
H_MULTIMAP{_,_} MULTIMAP{_,_}



Public


Features
elt_eq(e1,e2:ETP):BOOL .. Included as elt_eq
**** The "less than" relation used in the sorting routines. Compares the object "id" by default. May be redefined in descendants.
elt_hash(e:ETP):INT .. Included as elt_hash
**** A hash value associated with an element. Must have the property that if "elt_eq(e1,e2)" then "elt_hash(e1)=elt_hash(e2)". Can be defined to always return 0, but many routines will then become quadratic. Uses object "id" by default. May be redefined in descendants.
elt_if(test:ROUT{E}:BOOL,out res:E):BOOL .. Included as elt_if
**** Return the first element that satisfies "test" in "res" Return true if a element was found, false otherwise
elt_lt(e1,e2:ETP):BOOL .. Included as elt_lt
**** The "less than" relation used in the sorting routines. Compares the object "id" by default. May be redefined in descendants.
elt_nil: ETP .. Included as elt_nil
**** Return the nil value. If the element is under $NIL then return e.nil. Otherwise, return void
_
equals(b: $RO_MULTIMAP{K,E}): BOOL .. Included as equals
**** Returns true if all of "e"'s elements are equal to self's elts Ordering is an issue. Should be redefined to be more precise for particular descendants
has(e: E): BOOL .. Included as has
**** Return true if this multimap has the element "e"
has_elt(e: E): BOOL .. Included as has_elt
has_ind(k: K): BOOL .. Included as has_ind
**** Return true if the index "k" has at least one target in this multimap
ind_if(test:ROUT{E}:BOOL):K .. Included as ind_if
**** Return the index of the leftmost element that satisfies `test', or void if there is none. Must be changed to use an out argument
inds: ARRAY{K} .. Included as inds
**** Return an index array which is the same size as self and is set to the values of the indices
is_elt_nil(e:ETP):BOOL .. Included as is_elt_nil
stub n_inds: INT; .. Included as n_inds
**** Return the total number of indices
stub n_targets(k:K): INT; .. Included as n_targets
**** Return the number of targets for index "k"
stub size: INT; .. Included as size
**** The number of elements in this multimap
str: STR .. Included as str
**** Prints out a string version of the array of the components that are under $STR, and their associated indices
str_of_elts: STR .. Included as str_of_elts
**** Prints out a string version of the array of the components that are under $STR, and their associated indices
targets(k: K): BAG{E} .. Included as targets

Iters
stub elt!: E; .. Included as elt!
**** Yield elements (unordered)
filter!(once f:ROUT{E}:BOOL): E .. Included as filter!
**** Yield all elements that satisfy the boolean predicate "f"
filter_not!(once f:ROUT{E}:BOOL): E .. Included as filter_not!
**** Yield all elements that do not satisfy the boolean predicate "f"
stub ind!: K; .. Included as ind!
**** Yield element indices (unordered)
stub pair!: TUP{K,E}; .. Included as pair!
**** Yield pairs of index,element
stub target!(once k:K): E; .. Included as target!
**** Yield the targets of the index "k"
target!: E .. Included as target!


Private

elt_str(e: E): STR .. Included as elt_str
ind_str(i: K): STR .. Included as ind_str

The Sather Home Page